import sxMapJson from "../../assets/map-json/shanxi_610000_full.json";
export default {
  mounted() {
    const OPACITY = 0.7;
    this.$Echarts.registerMap('SX', sxMapJson);
    this.map = this.$Echarts.init(this.$refs.sx_map);
    this.map.setOption({
      geo: {
        map: 'SX',
        silent: true, //不响应鼠标
        aspectScale: 1,
        layoutSize: 800,
        layoutCenter: ['50%', '50%'],
        label: {
          show: true,
          formatter: p => {return p.name.substring(0, p.name.length - 1)},
          color: '#44e7fb',
          fontSize: 20
        },
        itemStyle: {
          borderWidth: 2,
          borderColor: '#44e7fb'
        },
        regions: [
          //陕北地区
          {
            name: '榆林市',
            itemStyle: {
              areaColor: '#3397ad',
              opacity: OPACITY,
            }
          }, {
            name: '延安市',
            itemStyle: {
              areaColor: '#3397ad',
              opacity: OPACITY
            }
          },
          //关中地区
          {
            name: '宝鸡市',
            itemStyle: {
              areaColor: '#1d4660',
              opacity: OPACITY
            }
          }, {
            name: '咸阳市',
            itemStyle: {
              areaColor: '#1d4660',
              opacity: OPACITY
            }
          }, {
            name: '西安市',
            itemStyle: {
              areaColor: '#1d4660',
              opacity: OPACITY
            }
          }, {
            name: '铜川市',
            itemStyle: {
              areaColor: '#1d4660',
              opacity: OPACITY
            }
          }, {
            name: '渭南市',
            itemStyle: {
              areaColor: '#1d4660',
              opacity: OPACITY
            }
          }, 
          //陕南地区
          {
            name: '汉中市',
            itemStyle: {
              areaColor: '#4c8b9a',
              opacity: OPACITY
            }
          },  {
            name: '安康市',
            itemStyle: {
              areaColor: '#4c8b9a',
              opacity: OPACITY
            }
          }, {
            name: '商洛市',
            itemStyle: {
              areaColor: '#4c8b9a',
              opacity: OPACITY
            }
          }
        ]
      }
    });
  }
}